package com.wf.day_0619.test3.cglib;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @author mpk
 * @since 2024/6/19 19:04:11
 */
public class MyMethodInterceptor implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {

        System.out.println("开始执行"+method.getName()+"方法");

        Object result = methodProxy.invokeSuper(o, objects);

        System.out.println(method.getName()+"执行完毕！");

        return result;
    }
}
